/**
 * Definition for singly-linked list.
 * struct ListNode {
 *     int val;
 *     struct ListNode *next;
 * };
 */


int kthToLast(struct ListNode* head, int k){

    struct ListNode*fast=head;
    struct ListNode*slow=head;
    int cnt=k-1;
    while(fast&&cnt)
    {
        cnt--;
        fast=fast->next;
    }
    while(fast->next)
    {
        slow=slow->next;
        fast=fast->next;
    }
    return slow->val;
}